{include file="public/head"}
{include file="public/left"}
<!-- content -->

<div class="main_02_r">

    <!--内容区域-->
    <div class="site_01">
        <span>当前位置：</span><a href="#">城事社</a><i>></i><a href="#">分类信息</a>
    </div>

    <div class="nrq_01">
        <div class="gg_01">
            <span class="on">分类信息</span>
        </div>
        <div class="gg_02">
            <div class="gg_03">
                <div class="gg_03_t">
                    <a href="javascript:void(0);" class="a1 mgcsz_click">敏感词设置</a>
                    <span class="sp1">信息总数：<i>{$arr->total()}</i></span>
                    <em class="fr">
                        <form method="get">
                        <input type="text" name="search" value="{$search|default=''}" placeholder="请输入有关分类信息的关键词" class="gg_03_txt" /><input type="button" value="" class="gg_03_btn" />
                        </form>
                    </em>
                </div>
                <div class="flxx_01">
                    <table cellpadding="0" cellspacing="0">
                        <tr>
                            <th>序号</th>
                            <th>信息编号</th>
                            <th>信息内容</th>
                            <th>信息分类</th>
                            <th>发布者</th>
                            <th>
                                <em class="em1">
                                    <span>发布时间</span>
                                    <i><a href="#" class="a1"></a><a href="#" class="a2"></a></i>
                                </em>
                            </th>
                            <th>推荐</th>
                            <th>
                                <em class="em1">
                                    <span>浏览</span>
                                    <i><a href="#" class="a1"></a><a href="#" class="a2"></a></i>
                                </em>
                            </th>
                            <th>
                                <em class="em1">
                                    <span>留言</span>
                                    <i><a href="#" class="a1"></a><a href="#" class="a2"></a></i>
                                </em>
                            </th>
                            <th>操作</th>
                        </tr>
                        {volist name="arr" id="vo"}
                        <tr>
                            <td>{$vo.id}</td>
                            <td>{$vo.info_no}</td>
                            <td class="td3"><a href="javascript:show_content('{$vo.id}','{$vo.context}');" class="flxxbj_click"><span>{$vo.context|mb_substr=0,12,'utf-8'}</span><i></i></a></td>
                            <td>{$vo.classify_first_name} - {$vo.classify_second_name}</td>
                            <td>{$vo.nick_name}</td>
                            <td>{$vo.create_time}</td>
                            <td class="td7 flxx_click">
                                <em value="{$vo.id}" class="{if condition='$vo.recommend_flag == 1'}on{/if}"><b></b></em>
                            </td>
                            <td>{$vo.browse_count}</td>
                            <td>{$vo.msg_count}</td>
                            <td>
                                <a href="#" class="a1">详情</a><a href="javascript:ajax_index_delete('{$vo.id}')" class="a1">删除</a>
                            </td>
                        </tr>
                        {/volist}
                    </table>
                    <script type="text/javascript">
                        $(".flxx_click").each(function () {
                            $(this).find("em").click(function () {
                                var id = $(this).attr("value");
                                if ($(this).attr("class") != "on") {
                                    ajax_show("ajax_index_show",{"id":id,"recommend_flag":1});
                                    $(this).addClass("on");
                                }
                                else {
                                    ajax_show("ajax_index_show",{"id":id,"recommend_flag":0});
                                    $(this).removeClass("on");
                                }
                            });
                        });
                    </script>
                </div>
                <div class="gg_03_b">
                    <div class="fl">
                        <span>共 <i>{$arr->total()}</i> 条</span><span>每页 <i>{$arr->listRows()}</i> 条</span>
                    </div>
                    <div class="fr">
                        {$arr->render()}
                    </div>
                </div>
            </div>
        </div>

    </div>

</div>
</div>

<!--分类信息-编辑弹窗-->
<div class="flxxtc_fr">
    <div class="ggtcxq_bg"></div>
    <div class="ggtcxq_c">
        <div class="ggtcxq_cfr">
            <div class="ggtcxqc_t">
                <span>编辑</span><a href="javascript:void(0);" class="close"></a>
            </div>
            <div class="fbgg_01">
                <form class="ajax_context_form" action="ajax_index_context">
                <input type="hidden" id="info_id" name="id" value="" />
                <p><span>信息内容</span><textarea id="info_context" name="context" rows="1" cols="1"></textarea></p>
                <p><span>&nbsp;</span><input type="button" value="确定" class="fbgg_01_btn ajax_context_submit" /></p>
                </form>
            </div>
        </div>
    </div>
</div>

<script type="text/javascript">
    $(".flxxbj_click").each(function () {
        $(this).click(function () {
            $(".flxxtc_fr").show();
            $(".flxxtc_fr .ggtcxq_c").css({ "margin-top": "-" + $(".flxxtc_fr .ggtcxq_c").height() / 2 + "px" });
        });
    });
    $(".flxxtc_fr .close").click(function () {
        $(".flxxtc_fr").hide();
    });
    $(".flxxtc_fr .ggtcxq_bg").click(function () {
        $(".flxxtc_fr").hide();
    });
</script>

<!--敏感词设置弹窗-->
<div class="mgcsz_fr">
    <div class="ggtcxq_bg"></div>
    <div class="ggtcxq_c">
        <div class="ggtcxq_cfr">
            <div class="ggtcxqc_t">
                <span>敏感词设置</span><a href="javascript:void(0);" class="close"></a>
            </div>
            <div class="fbgg_01">
                <form action="sensitive" class="ajax_sensitive_form">
                <p class="p2">
                    <span>添加敏感词</span>
                    <textarea style="overflow-x: hidden; overflow-y: auto;  " name="sensitive" rows="1" cols="1">{volist name="sensitive" id="v"}*{$v.words}*&#10;{/volist}</textarea>
                </p>
                <p class="p1">
                    <span>&nbsp;</span><i>每个敏感词一行，可使用通配符*</i>
                </p>
                <p><span>&nbsp;</span><input type="button" value="确定" class="fbgg_01_btn ajax_sensitive_submit" /></p>
                </form>
            </div>
        </div>
    </div>
</div>

<script type="text/javascript">
    $(".mgcsz_click").click(function () {
        $(".mgcsz_fr").show();
        $(".mgcsz_fr .ggtcxq_c").css({ "margin-top": "-" + $(".mgcsz_fr .ggtcxq_c").height() / 2 + "px" });
    });
    $(".mgcsz_fr .close").click(function () {
        $(".mgcsz_fr").hide();
    });
    $(".mgcsz_fr .ggtcxq_bg").click(function () {
        $(".mgcsz_fr").hide();
    });
</script>
<script type="text/javascript">
    $(function () {
        $(".ajax_context_submit").click(function(){
            var url = $('.ajax_context_form').attr("action")?$('.ajax_context_form').attr("action"):"{:url()}";
            var data = $('.ajax_context_form').serialize();
            ajax_post(url,data);
        });
    })

    $(function () {
        $(".ajax_sensitive_submit").click(function(){
            var url = $('.ajax_sensitive_form').attr("action")?$('.ajax_sensitive_form').attr("action"):"{:url()}";
            var data = $('.ajax_sensitive_form').serialize();
            ajax_post(url,data);
        });
    })

    function show_content(id,context) {
        $("#info_id").val(id);
        $("#info_context").html(context)
    }

    function ajax_index_delete(id) {
        ajax_post("ajax_index_delete",{"id":id});
    }

    function ajax_show(url,data){
        $.ajax({
            url:url,
            type: "POST",//方法类型
            // dataType: "json",//预期服务器返回的数据类型
            data: data,
            success: function (data) {
                if (data.code === 1) {
                    layer.msg("<span style='margin-left: 18px;'>"+data.msg+"</span>",{icon: 1,time:1000},function(){
                        //window.location.href=data.url;
                    });
                }else{
                    layer.msg("<span style='margin-left: 18px;'>"+data.msg+"</span>",{icon: 2,time:1000},function(){
                        location.reload();
                        /*if(data.url){
                            window.location.href=data.url;
                        }else{
                            location.reload();
                        }*/
                    });
                }
            },
            error : function() {
                layer.msg("<span style='margin-left: 18px;'>请求错误,请联系管理员</span>",{icon: 0,time:1000},function(){

                });
            }
        });
    }

    function ajax_post(url,data){
        $.ajax({
            url:url,
            type: "POST",//方法类型
            // dataType: "json",//预期服务器返回的数据类型
            data: data,
            contentType:"application/x-www-form-urlencoded; charset=utf-8",
            success: function (data) {
                if (data.code === 1) {
                    layer.msg("<span style='margin-left: 18px;'>"+data.msg+"</span>",{icon: 1,time:1000},function(){
                        window.location.href=data.url;
                    });
                }else{
                    layer.msg("<span style='margin-left: 18px;'>"+data.msg+"</span>",{icon: 2,time:1000},function(){
                        /*if(data.url){
                            window.location.href=data.url;
                        }else{
                            location.reload();
                        }*/
                    });
                }
            },
            error : function() {
                layer.msg("<span style='margin-left: 18px;'>请求错误,请联系管理员</span>",{icon: 0,time:1000},function(){
                    //location.reload();
                });
            }
        });
    }
</script>

<!-- content -->
{include file="public/foot"}